{extend name="public/base" /} {block name="body"}
<div class="content-tabs">
	<ol class="breadcrumb">
		<li>
			<a href="{:url('index/index')}"><i class="fa fa-home"></i></a>
		</li>
		<li><strong>商品管理</strong></li>
	</ol>
</div>
<div class="ibox float-e-margins">
	<div class="ibox-content">
		<form method="post" action="{:url('index')}">
			<div class="form-group" style="padding-left: 20px;">
				商品名称 <input type="text" id="goods_name" name="goods_name" value="" placeholder="请输入商品名称" class="bank" />
				<span class="bank"><button type="submit" class="btn btn-sm btn-primary"><li class="fa fa-search"> 查询</li></button> </span>
			</div>
		</form>
		<div class="hr-line-dashed" style="margin: 3px;"></div>
		<a href="{:url('add')}" class="btn btn-xs btn-primary">添加商品</a>
		<a href="{:url('padd')}" class="btn btn-xs btn-primary">导入</a>
		<a href="{:url('dc',['data'=>'1'])}" class="btn btn-xs btn-primary">导出</a>
		<div class="example-wrap">
			<div class="example">				
					<table class="table table-bordered table-hover">
						<thead>
							<tr class="long-th">
								<th>商品名称</th>
								<th>销售价(元)</th>
								<th>积分兑换状态</th>
								<th>兑换所需积分</th>
								<th>是否管理库存</th>
								<th>是否赠送</th>
								<th>库存</th>
								<th>添加时间</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							{foreach name="list" item="ad"}
							<tr>	
								<td class="text-center">{$ad.goods_name}</td>
								<td class="text-center">{$ad.sale_price}</td>
								<td class="text-center">
									{if $ad.stock_flag == 1}
									允许兑换
									{else}
									禁止兑换
									{/if}
								</td>
								<td class="text-center">{$ad.exchange_bouns}</td>
								<td class="text-center">
									{if $ad.bouns_flag == 1}
									是
									{else}
									否
									{/if}
								</td>
								<td class="text-center">
									{if $ad.is_zs == 1}
									是
									{else}
									否
									{/if}
								</td>
								<td class="text-center">{$ad.stock}</td>
								<td class="text-center">{$ad.add_time}</td>
								<td class="text-center">
									<a href="{:url('edit',['id'=>$ad.id])}" class="btn btn-primary bnt-sm">
										<i class="fa fa-paste"></i> 编辑</a>&nbsp;&nbsp;
									<a onclick="isms('{$ad.id}')" class="btn btn-primary btn-outline">编辑活动</a>&nbsp;&nbsp;
									{if condition="$ad.goods_state == 2"}
									<a href="{:url('offshelf',['id'=>$ad.id,'goods_state'=>$ad.goods_state])}" class="btn btn-danger bnt-sm ajax-do">
										<i class="fa fa-cart-arrow-down"></i> 下架</a>&nbsp;&nbsp; 
									{else}
									<a href="{:url('offshelf',['id'=>$ad.id,'goods_state'=>$ad.goods_state])}" class="btn btn-primary bnt-sm ajax-do">
										<i class="fa fa-cart-plus"></i> 上架</a>&nbsp;&nbsp; 
									{/if}
									<a href="{:url('delete',['id'=>$ad.id])}" class="btn btn-danger bnt-sm ajax-delete">
										<i class="fa fa-trash-o"></i> 删除</a>
								</td>
							</tr>
							{/foreach}
						</tbody>
					</table>
					<div style="text-align: right;">
                      {$list->render()}
                   </div>				
			</div>
		</div>
	</div>
</div>
{/block} {block name="script"}
<script>
</script>
<style>
.bank{
	width: 150px;
    height:30px;
    text-align:center;
    border-radius:5px;
}
</style>
{/block}
{block name="script"}
<script>
	//秒杀
	function isms(id){
		layer.open({		
	  	type: 2, 
	  	id: "msview",
	 	area: ['850px', '550px'] ,
	 	title: '商品活动编辑设置',
	 	scrollbar: false,
	  	content: '/admin/goods/msview?id='+id //这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
		}); 
	}
</script>
{/block}
	
